
let env = process.env;

export async function hxrecords(data) {
    const response = await fetch(
    env.VUE_APP_BASE_URL+'/product/v31/api/writeoffrecord/list', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
        body: JSON.stringify(data)
    }
    )
    return response.json();
}

// 汇付账户绑定
export async function huifuBusiBind(data) {
    const response = await fetch(
    env.VUE_APP_BASE_URL+'/product/v31/api/merchant/huifu/merchant/busi/open', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
        body: JSON.stringify(data)
    }
    )
    return response.json();
}

 // 汇付账户绑定
export async function huifuUserBind(data) {
    const response = await fetch(
    env.VUE_APP_BASE_URL+'/product/v31/api/merchant/huifu/user/bind', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
        body: JSON.stringify(data)
    }
    )
    return response.json();
}
// 绑定进件
export async function bindSaveMerchantByChannel(data) {
    const response = await fetch(
    env.VUE_APP_BASE_URL+'/product/v31/api/merchant/bindSaveMerchantByChannel', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
        body: JSON.stringify(data)
    }
    )
    return response.json();
}

// 汇聚开户
export async function huijuBasicdataIndv(data) {
    const response = await fetch(
    env.VUE_APP_BASE_URL+'/product/v31/api/merchant/huiju/user/basicdata/indv', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
        body: JSON.stringify(data)
    }
    )
    return response.json();
}


// 汇付余额支付 
export async function AbankInfoList(data) {
    const response = await fetch(
    env.VUE_APP_BASE_URL+'/yfpay/api/info/bank', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
        body: JSON.stringify(data)
    }
    )
    return response.json();
}

// 汇付余额支付 
export async function acctpaymentPay(data) {
    const response = await fetch(
    env.VUE_APP_BASE_URL+'/product/v31/api/merchant/huifu/v2/trade/acctpayment/pay', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
        body: JSON.stringify(data)
    }
    )
    return response.json();
}

// 汇付提现
export async function enchashment(data) {
    const response = await fetch(
    env.VUE_APP_BASE_URL+'/product/v31/api/merchant/huifu/v2/trade/settlement/enchashment', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
        body: JSON.stringify(data)
    }
    )
    return response.json();
}

// 用户信息（余额）查询
export async function bankInfolist(data) {
    const response = await fetch(
    env.VUE_APP_BASE_URL+'/yfpay/api/info/getBank', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
        body: JSON.stringify(data)
    }
    )
    return response.json();
}

// 用户信息（余额）查询
export async function basicdataQuery(data) {
    const response = await fetch(
    env.VUE_APP_BASE_URL+'/product/v31/api/merchant/huifu/user/basicdata/query', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
        body: JSON.stringify(data)
    }
    )
    return response.json();
}

// // 用户列表查询
// export async function basicdataQuery(data) {
//     const response = await fetch(
//     env.VUE_APP_BASE_URL+'/product/v31/api/merchant/huifu/user/list/query', {
//         method: 'POST',
//         headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
//         body: JSON.stringify(data)
//     }
//     )
//     return response.json();
// }

// 用户业务入驻
export async function huifuUserUusiOpen(data) {
    const response = await fetch(
    env.VUE_APP_BASE_URL+'/product/v31/api/merchant/huifu/user/busi/open', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
        body: JSON.stringify(data)
    }
    )
    return response.json();
}

// 企业用户基本信息修改
export async function basicdataEntModify(data) {
    const response = await fetch(
    env.VUE_APP_BASE_URL+'/product/v31/api/merchant/huifu/user/basicdata/ent/modify', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
        body: JSON.stringify(data)
    }
    )
    return response.json();
}

// 企业用户基本信息开户
export async function basicdataEnt(data) {
    const response = await fetch(
    env.VUE_APP_BASE_URL+'/product/v31/api/merchant/huifu/user/basicdata/ent', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
        body: JSON.stringify(data)
    }
    )
    return response.json();
}

// 个人用户基本信息修改
export async function basicdataUpdata(data) {
    const response = await fetch(
    env.VUE_APP_BASE_URL+'/product/v31/api/merchant/huifu/user/basicdata/indv/modify', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
        body: JSON.stringify(data)
    }
    )
    return response.json();
}

// 用户业务信息修改
export async function busimodify(data) {
    const response = await fetch(
    env.VUE_APP_BASE_URL+'/product/v31/api/merchant/huifu/user/busi/modify', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
        body: JSON.stringify(data)
    }
    )
    return response.json();
}
// 
export async function basicdataIndv(data) {
    const response = await fetch(
    env.VUE_APP_BASE_URL+'/product/v31/api/merchant/huifu/user/basicdata/indv', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
        body: JSON.stringify(data)
    }
    )
    return response.json();
}

// 个人用户基本信息开户
// export async function basicdataIndv(data) {
//     const response = await fetch(
//         env.VUE_APP_BASE_URL +`/product/v31/api/merchant/huifu/user/basicdata/indv`, {
//             method: 'POST',
//             headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
//             body: JSON.stringify(data)
//         }
//         )
//         return response.json();
//   }

// 
export async function getOrderDetail(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +`/product/v31/api/cycle/order/getOrderDetail`, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }
      // 3.0商品下架
export async function updateCardsStatus(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +`/cycle/v3/product/templateStatusModify `, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }
    // 3.0商品列表
export async function findPage(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +`/cycle/v3/product/findPcPage?page=${data.page}&size=${data.size}`, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }
  // 任务红包绑定
export async function bindActivity(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +`/product/v31/api/cycle/cycleBanner/bindActivity`, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }
// 任务红包通知  
export async function planetNotify(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +`/cycle/planet/notify`, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }
//   任务红包活动创建
export async function planetCreate(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +`/cycle/planet/create`, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }

 //  3.0商户编辑
export async function merchantEdit(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +`/product/v31/api/cycle/v3/merchant/edit`, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }
  //  3.0商户新增
export async function merchantAdd(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +`/product/v31/api/cycle/v3/merchant/add`, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }
  //  3.0商户列表
export async function merchantPage(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +`/product/v31/api/cycle/v3/merchant/page`, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }
//  任务红包列表
export async function planetQueryPage(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +`/cycle/planet/queryPage`, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }
// 订单列表
export async function orderList(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +`/product/v31/api/cycle/order/page?page=${data.page}&size=${data.size}`, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }
// 门店编辑
export async function shopModify(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +`/cycle/shop/shopModify`, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }
// 门店新增
export async function shopCreate(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +`/cycle/shop/shopCreate`, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }
// 商品详情
export async function productQuery(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +`/cycle/product/orderQuery`, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }
// 上下架商户商品
export async function updateStatus(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +`/cycle/product/updateStatus`, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }

// 新增商户商品
export async function saveOrUpdate(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +`/cycle/product/saveOrUpdate`, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }

  // 系统门店绑定
  export async function bindShop(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +`/product/v31/api/cycle/shop/bindShop?lsyShopId=${data.lsyShopId}&shopId=${data.shopId}`, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }
  // 系统商户绑定
export async function bindSysMerchant(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +`/product/v31/api/cycle/merchant/bindSysMerchant?simpleMerchantId=${data.simpleMerchantId}&merchantId=${data.merchantId}`, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }

// 同步门店
export async function synShopInfo(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +`/cycle/shop/synShopInfo`, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }
  // 同步商品
export async function synInfoProduct(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +`/cycle/product/synInfoProduct`, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }
// 同步商户
export async function synInfoMerchant(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +`/cycle/merchants/synInfoMerchant `, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }
// 版本管理同步
export async function synInfoConstruct(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +`/cycle/construct/synInfoConstruct`, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }

// 门店列表
export async function shopQueryList(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +`/product/v31/api/cycle/shop/page?page=${data.page}&size=${data.size}`, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }

// 商品列表
export async function productPage(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +`/product/v31/api/cycle/product/page?page=${data.page}&size=${data.size}`, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }
// 图标上传
export async function logoUpload(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +`/cycle/orders/logoUpload`, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }
// 商户绑定
export async function createMerchant(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +`/cycle/merchants/createMerchant`, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }
// 门店Banner编辑
export async function cycleBannerEdit(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +`/product/v31/api/cycle/cycleBanner/edit`, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }

// 门店Banner列表
export async function cydeBannerPage(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +`/product/v31/api/cycle/cycleBanner/page?page=${data.page}&size=${data.size}`, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }

// 新增门店Banner
export async function cycleBannerAdd(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +'/product/v31/api/cycle/cycleBanner/add', {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }
// 审核详情
export async function reviewQuery(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +'/cycle/review/query', {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }
// 订购列表  
export async function subscriptionPage(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +`/product/v31/api/cycle/subScription/page?page=${data.page}&size=${data.size}`, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }

// 订购解约 
export async function subscriptionSurrender(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +'/cycle/subscription/subscriptionSurrender', {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }
// 商户证件 图片上传  门店图片上传
export async function simpleCreateUpload(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +'/cycle/merchants/simpleCreateUpload', {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }
//   商户废弃
export async function merchantsDelete(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +'/cycle/merchants/delete', {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }
// 商户进件
export async function simpleCreate(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +'/cycle/merchants/simpleCreate', {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }

// 商户进件列表
export async function simpleCreateQuery(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +`/product/v31/api/cycle/merchant/page?size=${data.size}&page=${data.page}`, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }
// 省市区列表获取 
export async function getAreaAll(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +'/product/v31/area/getAreaAll', {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            // body: JSON.stringify({})
        }
        )
        return response.json();
  }
// 省市区列表获取 
export async function getAreaList(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL +'/cycle/merchants/getArea', {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify({})
        }
        )
        return response.json();
  }
  //上架小程序版本
export async function upDownOnline(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL+'/cycle/upDown/online', {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
}

  //下架小程序版本
  export async function upDownOffline(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL+'/cycle/upDown/offline', {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
}

//审核小程序版本
export async function reviewApply(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL+'/cycle/review/apply', {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
}

 //获取构建小程序版本列表
export async function getUploadInfo(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL+`/product/v31/api/cycle/construct/page?size=${data.size}&page=${data.page}`, {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }

 //构建小程序版本
export async function constructUpload(data) {
    const response = await fetch(
        env.VUE_APP_BASE_URL+'/cycle/construct/upload', {
            method: 'POST',
            headers: { 'Content-Type': 'application/json;charset=UTF-8', Token: sessionStorage.getItem("token") },
            body: JSON.stringify(data)
        }
        )
        return response.json();
  }